package edu.zut.array;

import java.util.Scanner;

public class ArraysTest {
    public static void main(String[] args) {

        int[] scores = {65, 89, 56, 78, 45, 69, 89, 59};

        //获取及格成绩
        for (int i = 0; i < scores.length; i++) {
            if (scores[i] >= 60) {
                System.out.println(scores[i]);
            }
        }

        /*利用控制台，输入学生的三门课程成绩，
        将成绩保存到一个数组中，并利用for循环计算这三门成绩之和。*/
        Scanner scanner = new Scanner(System.in);
        int[] arr = new int[3];
        for (int i = 0; i < 3; i++) {
            System.out.println("输入成绩：");
            int j = scanner.nextInt();
            arr[i] = j;
        }
        //循环计算arr的和
        int sum = 0;
        for (int i : arr) {
            sum += i;
        }
        System.out.println("成绩之和：" + sum);



    }

}
